<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="gly"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head>
<meta charset="GB18030">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/static/css/main.css">

</head>
<body style="margin-top: -50px">
	<div class="panel panel-default" style="margin-top: 0px">
		<div class="panel-heading">
			<h3 class="panel-title">
				<i class="glyphicon glyphicon-th"></i> 车辆档案
			</h3>
		</div>
		<div class="panel-body">
			<form class="form-inline" role="form" style="float: left;">

				<div class="form-group has-feedback">
					<div class="input-group">
						<div class="input-group-addon">车牌号码</div>
						<input class="form-control has-success" type="text"
							placeholder="支持模糊查询" id="searchCondition" /> <input
							id="condition" type="text" hidden value="" /> <input id="pn"
							type="text" hidden value="1" />
					</div>
				</div>
				<button type="button" class="btn btn-warning" id="search_btn">
					<i class="glyphicon glyphicon-search"></i> 查询
				</button>
			</form>

			<button class="btn btn-danger"
				style="float: right; margin-left: 10px;" id="delCars_btn">
				<i class=" glyphicon glyphicon-remove"></i> 批量删除
			</button>
			<button class="btn btn-info" style="float: right; margin-left: 10px;"
				id="add">
				<i class=" glyphicon glyphicon-plus"></i> 新增
			</button>
			<br>
			<hr style="clear: both;">
			<div class="table-responsive">
				<table class="table  table-bordered">
					<thead>
						<tr>
							<th width="30">#</th>
							<th width="30"><input type="checkbox" id="selectAll"></th>
							<th>车牌号码</th>
							<th>车辆品牌</th>
							<th>车辆型号</th>
							<th>车辆颜色</th>
							<th>座位数</th>
							<th>所属部门</th>
							<th>车辆状态</th>
							<th>是否启用</th>
							<th width="125">操作</th>
						</tr>
					</thead>
					<!-- 信息展示 -->
					<tbody id="tb1">
					</tbody>
				</table>
			</div>
			<!-- 分页信息 -->
			<div class="row" id="page_div"></div>
		</div>
		<!-- 新增/修改模态框 -->
		<div class="modal fade" id="carModel" tabindex="-1" role="dialog"
			aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="myModalLabel">新增车辆信息</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" id="form1">
							<input type="text" id="inputcarId" name="carId" hidden>
							<div class="form-group">
								<label for="inputcarLicense" class="col-sm-2 control-label">车牌号码</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="inputcarLicense"
										name="carLicense" placeholder="请输入车牌号码" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarBrand" class="col-sm-2 control-label">品牌</label>
								<div class="col-sm-10">
									<select class="form-control" id="inputcarBrand" name="carBrand">

									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarModel" class="col-sm-2 control-label">型号</label>
								<div class="col-sm-10">
									<select class="form-control" id="inputcarModel" name="carModel">

									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarColor" class="col-sm-2 control-label">颜色</label>
								<div class="col-sm-10">
									<select class="form-control" id="inputcarColor" name="carColor">
									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarLoad" class="col-sm-2 control-label">载重（吨）</label>
								<div class="col-sm-10">
									<input type="number" class="form-control" id="inputcarLoad"
										name="carLoad" placeholder="请输入车辆载重" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarSeat" class="col-sm-2 control-label">座位数</label>
								<div class="col-sm-10">
									<input type="number" class="form-control" id="inputcarSeat"
										name="carSeat" placeholder="请输入座位数" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarOilwear" class="col-sm-2 control-label">油耗（百公里）</label>
								<div class="col-sm-10">
									<input type="number" class="form-control" id="inputcarOilwear"
										name="carOilwear" placeholder="请输入油耗（百公里）" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarInitmileage" class="col-sm-2 control-label">初始里程（公里）</label>
								<div class="col-sm-10">
									<input type="number" class="form-control"
										id="inputcarInitmileage" name="carInitmileage"
										placeholder="请输入初始里程（公里）" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarUpkeepmileage"
									class="col-sm-2 control-label">保养里程（公里）</label>
								<div class="col-sm-10">
									<input type="number" class="form-control"
										id="inputcarUpkeepmileage" name="carUpkeepmileage"
										placeholder="请输入保养里程（公里）" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarUpkeeptime" class="col-sm-2 control-label">保养周期（月）</label>
								<div class="col-sm-10">
									<input type="number" class="form-control"
										id="inputcarUpkeeptime" name="carUpkeeptime"
										placeholder="请输入保养周期（月）" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarEnginenum" class="col-sm-2 control-label">发动机号码</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="inputcarEnginenum"
										name="carEnginenum" placeholder="请输入发动机号码" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarFramenum" class="col-sm-2 control-label">车架号</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="inputcarFramenum"
										name="carFramenum" placeholder="请输入车架号" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarSupplier" class="col-sm-2 control-label">供应商</label>
								<div class="col-sm-10">
									<select class="form-control" id="inputcarSupplier"
										name="carSupplier">

									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarPrice" class="col-sm-2 control-label">购买价格</label>
								<div class="col-sm-10">
									<input type="number" class="form-control" id="inputcarPrice"
										name="carPrice" placeholder="请输入购买价格" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarBuytime" class="col-sm-2 control-label">购买日期</label>
								<div class="col-sm-10">
									<input type="date" class="form-control" id="inputcarBuytime"
										name="carBuytime" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarDept" class="col-sm-2 control-label">所属部门</label>
								<div class="col-sm-10">
									<select class="form-control" id="inputcarcarDept"
										name="carDept">

									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarStatus" class="col-sm-2 control-label">车辆状态</label>
								<div class="col-sm-10">
									<select class="form-control" id="inputcarStatus"
										name="carStatus">
									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarRemark" class="col-sm-2 control-label">备注</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="inputcarRemark"
										name="carRemark" placeholder="请输入备注" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputcarIsuse" class="col-sm-2 control-label">启用状态</label>
								<div class="col-sm-10">
									<input type="radio" name="carIsuse" value="启用" checked id="qy">启用&nbsp;&nbsp;
									<input type="radio" name="carIsuse" value="禁用" id="jy">禁用&nbsp;&nbsp;
								</div>
							</div>
						</form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" id="sub1">保存</button>
					</div>

				</div>
			</div>
		</div>
		<!-- 新增修改模态框结束 -->
		<!-- 详细信息模态框 -->
		<div class="modal fade" id="carInfoModel" tabindex="-1" role="dialog"
			aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="myModalLabel">车辆详细信息</h4>
					</div>
					<div class="modal-body">
						<table class="table  table-bordered">
							<thead>
								<tr>
									<th width="200px;">名称</th>
									<th>内容</th>

								</tr>
							</thead>
							<tbody id="info_tb">

							</tbody>
						</table>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>

				</div>
			</div>
		</div>
		<!-- 详细信息模态框结束 -->
		<script
			src="${pageContext.request.contextPath}/static/jquery/jquery-2.1.1.min.js"></script>
		<script
			src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
		<script
			src="${pageContext.request.contextPath}/static/script/docs.min.js"></script>
		<script type="text/javascript">
			$(function() {
				//加载数据
				loadCars();
				//查询
				$("#search_btn").click(function() {
					var searchcondition = $("#searchCondition").val();
					$("#condition").val(searchcondition);
					$("#pn").val(1);
					loadCars();
				})
				//复选框的选中与取消
				$("#selectAll").change(function() {
					if ($(this).prop('checked') == true) {
						$('input[name="cb"]').each(function() {
							$(this).prop('checked', true);
						})
					} else {
						$('input[name="cb"]').each(function() {
							$(this).prop('checked', false);
						})
					}

				});
				//批量删除
				$("#delCars_btn")
						.click(
								function() {
									var ids = [];
									$(":checkbox[name=cb]:checked").each(
											function() {
												ids.push($(this).val());
											});
									if (ids.length == 0) {
										alert("请选择删除记录");
										return;
									}
									if (confirm("是否删除？")) {
										$
												.ajax({
													url : "${pageContext.request.contextPath}/car/delete",
													type : "post",
													data : {
														"carIds" : ids
																.join(",")
													},
													success : function(data) {
														alert(data);
														loadCars();
													}
												})
									}

								});
				//新增
				$("#add")
						.click(
								function() {
									$("#myModalLabel").html("新增车辆信息");
									$
											.ajax({
												url : "${pageContext.request.contextPath}/car/add",
												type : "get",
												dataType : "json",
												success : function(data) {
													var brands = data.brands;
													var Suppliers = data.Suppliers;
													var depts = data.depts;
													var models = data.models;
													var brandsStr = "";
													for (var i = 0; i < brands.length; i++) {
														brandsStr = brandsStr
																+ "<option>"
																+ brands[i]
																+ "</option>";
													}
													$("#inputcarBrand").html(
															brandsStr);
													var modelsStr = "";
													for (var i = 0; i < models.length; i++) {
														modelsStr = modelsStr
																+ "<option>"
																+ models[i]
																+ "</option>";
													}
													$("#inputcarModel").html(
															modelsStr);
													var SuppliersStr = "";
													for (var i = 0; i < Suppliers.length; i++) {
														SuppliersStr = SuppliersStr
																+ "<option>"
																+ Suppliers[i]
																+ "</option>";
													}
													$("#inputcarSupplier")
															.html(SuppliersStr);
													var deptsStr = "";
													for (var i = 0; i < depts.length; i++) {
														deptsStr = deptsStr
																+ "<option>"
																+ depts[i]
																+ "</option>";
													}
													$("#inputcarcarDept").html(
															deptsStr);
													var color = [ "白色", "黑色",
															"银色" ];
													var colorStr = "";
													for (var i = 0; i < color.length; i++) {
														colorStr = colorStr
																+ "<option>"
																+ color[i]
																+ "</option>";
													}
													$("#inputcarColor").html(
															colorStr);
													var status = [ "可用", "出车",
															"维修", "其他" ];
													var statusStr = "";
													for (var i = 0; i < status.length; i++) {
														statusStr = statusStr
																+ "<option>"
																+ status[i]
																+ "</option>";
													}
													$("#inputcarStatus").html(
															statusStr);
													$("#inputcarLicense").prop(
															"readonly", false);
													var da = new Date().format('yyyy-MM-dd');
													$("#inputcarBuytime").val(da);
													
												}
											});

									$('#carModel').modal('show');
								})

				//品牌联动型号
				$("#inputcarBrand")
						.change(
								function() {
									var brand = $(
											"#inputcarBrand option:selected")
											.text();
									$
											.ajax({
												url : "${pageContext.request.contextPath}/car/add_getModel",
												type : "post",
												dataType : "json",
												data : {
													"brand" : brand
												},
												success : function(data) {
													var modelsStr = "";
													for (var i = 0; i < data.length; i++) {
														modelsStr = modelsStr
																+ "<option>"
																+ data[i]
																+ "</option>";
													}
													$("#inputcarModel").html(
															modelsStr);
												}
											})
								})

				//保存新增或修改
				$("#sub1")
						.click(
								function() {
									if ($("#inputcarLicense").prop("readonly") == true) {
										$
												.ajax({
													url : "${pageContext.request.contextPath}/car/doUpdate",
													type : "post",
													data : $("#form1")
															.serialize(),
													error : function() {
														alert("请输入正确日期格式");
													},
													success : function(data) {
														$('#carModel').modal(
																'hide');
														loadCars();
													}

												});
									} else {
										$
												.ajax({
													url : "${pageContext.request.contextPath}/car/doAdd",
													type : "post",
													data : $("#form1")
															.serialize(),
													error : function() {
														alert("请输入正确日期格式");
													},
													success : function(data) {
														$('#carModel').modal(
																'hide');
														loadCars();

													}

												});
									}
								});

				$('#carModel').on('hidden.bs.modal', function() {
					$("#form1")[0].reset();
				})

			})
		</script>

		<script type="text/javascript">
		    //数据加载
			function loadCars() {
				var pn = $("#pn").val();
				var condition = $("#condition").val();
				$
						.ajax({
							url : "${pageContext.request.contextPath}/car/getAll",
							type : "post",
							dataType : "json",
							data : {
								"pn" : pn,
								"condition" : condition
							},
							success : function(data) {
								var list = data.list;
								var trStr = "";
								for (var i = 0; i < list.length; i++) {
									trStr = trStr + "<tr>";
									trStr = trStr + "<td>" + (i + 1) + "</td>";
									trStr = trStr
											+ "<td><input type='checkbox' value='"+list[i].carId+"' name='cb'></td>";
									trStr = trStr + "<td>" + list[i].carLicense
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carBrand
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carModel
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carColor
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carSeat
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carDept
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carStatus
											+ "</td>";
									trStr = trStr + "<td>" + list[i].carIsuse
											+ "</td>";
									trStr = trStr + "<td>";
									trStr = trStr
											+ "<button type='button' class='btn btn-success btn-xs' name='carInfo' carid='"+list[i].carId+"'><i class=' glyphicon glyphicon-list-alt'></i></button>";
									trStr = trStr + "&nbsp";
									trStr = trStr
											+ "<button type='button' class='btn btn-primary  btn-xs' name='updateCar' carid='"+list[i].carId+"'><i class=' glyphicon glyphicon-pencil'></i></button>";
									trStr = trStr + "&nbsp";
									trStr = trStr
											+ "<button type='button' class='btn btn-danger   btn-xs' name='delCar' carid='"+list[i].carId+"'><i class=' glyphicon glyphicon-remove'></i></button>";
									trStr = trStr + "&nbsp";
									trStr = trStr
											+ "<button type='button' class='btn btn-info   btn-xs' name='showPicture' carid='"+list[i].carId+"'><i class=' glyphicon glyphicon-picture'></i></button>";
									trStr = trStr + "</td>";
									trStr = trStr + "</tr>";
								}
								$("#tb1").html(trStr);
								var divStr = "";
								divStr = divStr + "<div align='center'>";
								divStr = divStr + "<ul class='pagination'>";
								divStr = divStr
										+ "<li><a href='javascript:changePage(1)'>首页</a></li>";
								divStr = divStr + "<li>";
								if (data.hasPreviousPage) {
									divStr = divStr
											+ "<a href='javascript:changePage(-1)' aria-label='Previous'> <span aria-hidden='true'>«</span></a>";
								}
								divStr = divStr + "</li>";
								var navigatepageNums = data.navigatepageNums;
								for (var i = 0; i < navigatepageNums.length; i++) {
									if (navigatepageNums[i] == data.pageNum) {
										divStr = divStr
												+ "<li class='active'><a href='#'>"
												+ navigatepageNums[i]
												+ "</a></li>";
									}
									if (navigatepageNums[i] != data.pageNum) {
										divStr = divStr
												+ "<li><a href='javascript:changePage("
												+ navigatepageNums[i] + ")'>"
												+ navigatepageNums[i]
												+ "</a></li>";
									}
								}
								divStr = divStr + "<li>";
								if (data.hasNextPage) {
									divStr = divStr
											+ "<a href='javascript:changePage(-2)' aria-label='Next'> <span aria-hidden='true'>»</span> </a>";
								}
								divStr = divStr + "</li>";

								divStr = divStr
										+ "<li><a href='javascript:changePage("
										+ data.pages + ")'>尾页</a></li>";
								divStr = divStr + "</ul>";
								divStr = divStr + "</div>";
								divStr = divStr + "<div align='center'>当前第 "
										+ data.pageNum + " 页.总共 " + data.pages
										+ " 页.一共 " + data.total + " 条记录</div>";
								$("#page_div").html(divStr);
								//绑定函数
								deleteCar();
								showPictures();
								updateCar();
								carInfo();
							}

						});

			}
			//翻页
			function changePage(page) {
				var pn = $("#pn").val();
				if (page == -1) {
					$("#pn").val(pn - 1);
				} else if (page == -2) {
					var pn1 = parseInt(pn);
					$("#pn").val(pn1 + 1);
				} else {
					$("#pn").val(page);
				}

				loadCars();
			}
			//单个删除
			function deleteCar() {
				$("[name=delCar]").click(function() {
					var carId = $(this).attr("carid");
					$.ajax({
						url : "${pageContext.request.contextPath}/car/delete",
						type : "post",
						data : {
							"carIds" : carId
						},
						success : function(data) {
							loadCars();
						}
					})

				});
			}
			//修改
			function updateCar() {
				$("[name=updateCar]")
						.click(
								function() {
									$("#myModalLabel").html("修改车辆信息");
									var carId = $(this).attr("carid");
									$
											.ajax({
												url : "${pageContext.request.contextPath}/car/update?carId="
														+ carId,
												type : "get",
												dataType : "json",
												success : function(data) {
													var brands = data.brands;
													var Suppliers = data.Suppliers;
													var depts = data.depts;
													var models = data.models;
													var car = data.car;
													var brandsStr = "";
													for (var i = 0; i < brands.length; i++) {
														if (brands[i] == car.carBrand) {
															brandsStr = brandsStr
																	+ "<option selected>"
																	+ brands[i]
																	+ "</o 	ption>";
														} else {
															brandsStr = brandsStr
																	+ "<option>"
																	+ brands[i]
																	+ "</option>";
														}
													}
													$("#inputcarBrand").html(
															brandsStr);
													var modelsStr = "";
													for (var i = 0; i < models.length; i++) {
														if (models[i] == car.carModel) {
															modelsStr = modelsStr
																	+ "<option selected>"
																	+ models[i]
																	+ "</option>";
														} else {
															modelsStr = modelsStr
																	+ "<option>"
																	+ models[i]
																	+ "</option>";
														}
													}
													$("#inputcarModel").html(
															modelsStr);
													var SuppliersStr = "";
													for (var i = 0; i < Suppliers.length; i++) {
														if (Suppliers[i] == car.carSupplier) {
															SuppliersStr = SuppliersStr
																	+ "<option selected>"
																	+ Suppliers[i]
																	+ "</option>";
														} else {
															SuppliersStr = SuppliersStr
																	+ "<option>"
																	+ Suppliers[i]
																	+ "</option>";
														}
													}
													$("#inputcarSupplier")
															.html(SuppliersStr);
													var deptsStr = "";
													for (var i = 0; i < depts.length; i++) {
														if (depts[i] == car.carDept) {
															deptsStr = deptsStr
																	+ "<option selected>"
																	+ depts[i]
																	+ "</option>";
														} else {
															deptsStr = deptsStr
																	+ "<option>"
																	+ depts[i]
																	+ "</option>";
														}
													}
													$("#inputcarcarDept").html(
															deptsStr);
													var color = [ "白色", "黑色",
															"银色" ];
													var colorStr = "";
													for (var i = 0; i < color.length; i++) {
														if (color[i] == car.carColor) {
															colorStr = colorStr
																	+ "<option selected>"
																	+ color[i]
																	+ "</option>";
														} else {
															colorStr = colorStr
																	+ "<option>"
																	+ color[i]
																	+ "</option>";
														}
													}
													$("#inputcarColor").html(
															colorStr);
													var status = [ "可用", "出车",
															"维修", "其他" ];
													var statusStr = "";
													for (var i = 0; i < status.length; i++) {
														if (status[i] == car.carStatus) {
															statusStr = statusStr
																	+ "<option selected>"
																	+ status[i]
																	+ "</option>";
														} else {
															statusStr = statusStr
																	+ "<option>"
																	+ status[i]
																	+ "</option>";
														}
													}
													$("#inputcarStatus").html(
															statusStr);

													$("#inputcarId").val(
															car.carId);
													$("#inputcarLicense").val(
															car.carLicense);
													$("#inputcarLicense").prop(
															"readonly", true);
													$("#inputcarLoad").val(
															car.carLoad);
													$("#inputcarSeat").val(
															car.carSeat);
													$("#inputcarOilwear").val(
															car.carOilwear);
													$("#inputcarInitmileage")
															.val(
																	car.carInitmileage);
													$("#inputcarUpkeepmileage")
															.val(
																	car.carUpkeepmileage);
													$("#inputcarUpkeeptime")
															.val(
																	car.carUpkeeptime);
													$("#inputcarEnginenum")
															.val(
																	car.carEnginenum);
													$("#inputcarFramenum").val(
															car.carFramenum);
													$("#inputcarPrice").val(
															car.carPrice);
													$("#inputcarBuytime").val(
															car.carBuytime);
													$("#inputcarRemark").val(
															car.carRemark);

													if (car.carIsuse == "禁用") {
														$("#qy").prop(
																"checked",
																false);
														$("#jy")
																.prop(
																		"checked",
																		true);
													} else {
														$("#jy").prop(
																"checked",
																false);
														$("#qy")
																.prop(
																		"checked",
																		true);
													}
												}
											});
									$('#carModel').modal('show');
								})
			}

			//展示图片
			function showPictures() {
				$("[name=showPicture]")
						.click(
								function() {
									var carId = $(this).attr("carid");
									location.href = '${pageContext.request.contextPath}/car/showPicture?carId='
											+ carId;
								});
			}
			//展示详情
			function carInfo() {
				$("[name=carInfo]")
						.click(
								function() {
									var carId = $(this).attr("carid");
									$
											.ajax({
												url : "${pageContext.request.contextPath}/car/showInfo?carId="
														+ carId,
												type : "get",
												dataType : "json",
												success : function(data) {
													var str = "";
													str = str
															+ "<tr><td>车牌号码</td><td>";
													str = str + data.carLicense;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>车辆品牌</td><td>";
													str = str + data.carBrand;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>车辆型号</td><td>";
													str = str + data.carModel;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>车辆颜色</td><td>";
													str = str + data.carColor;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>载重量（吨）</td><td>";
													str = str + data.carLoad;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>座位数</td><td>";
													str = str + data.carSeat;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>油耗（百公里）</td><td>";
													str = str + data.carOilwear;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>初始里程（公里）</td><td>";
													str = str
															+ data.carInitmileage;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>保养里程（公里）</td><td>";
													str = str
															+ data.carUpkeepmileage;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>保养周期（月）</td><td>";
													str = str
															+ data.carUpkeeptime;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>发动机号</td><td>";
													str = str
															+ data.carEnginenum;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>车架号</td><td>";
													str = str
															+ data.carFramenum;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>供应商</td><td>";
													str = str
															+ data.carSupplier;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>购买价格</td><td>";
													str = str + data.carPrice;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>购买日期</td><td>";
													str = str + data.carBuytime;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>所属部门</td><td>";
													str = str + data.carDept;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>车辆状态</td><td>";
													str = str + data.carStatus;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>备注</td><td>";
													str = str + data.carRemark;
													str = str + "</td></tr>";
													str = str
															+ "<tr><td>启用状态</td><td>";
													str = str + data.carIsuse;
													str = str + "</td></tr>";

													$("#info_tb").html(str);
													$('#carInfoModel').modal(
															'show');
												}
											})
								})
			}
			Date.prototype.format = function(format){
			    var o = {
			        "M+" : this.getMonth()+1, //month
			        "d+" : this.getDate(), //day
			        "H+" : this.getHours(), //hour
			        "m+" : this.getMinutes(), //minute
			        "s+" : this.getSeconds(), //second
			        "q+" : Math.floor((this.getMonth()+3)/3), //quarter
			        "S" : this.getMilliseconds() //millisecond
			    }
			 
			    if(/(y+)/.test(format)) {
			        format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
			    }
			 
			    for(var k in o) {
			        if(new RegExp("("+ k +")").test(format)) {
			            format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
			        }
			    }
			    return format;
			}
		</script>
</body>
</html>